# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: rfaa <rfaa@rfaa.se>
pkgname=glfw-wayland
pkgver=3.3.2
pkgrel=0
pkgdesc="Multi-platform library for OpenGL and Vulkan application development (Wayland)"
options="!check" # tests requires a working wayland session
url="https://www.glfw.org/"
arch="all !armhf" # Limited by extra-cmake-modules
license="Zlib"
depends_dev="linux-headers mesa-dev extra-cmake-modules wayland-dev wayland-protocols
	libxkbcommon-dev"
makedepends="$depends_dev cmake"
subpackages="$pkgname-dev"
source="glfw-$pkgver.tar.gz::https://github.com/glfw/glfw/archive/$pkgver.tar.gz"
builddir="$srcdir/glfw-$pkgver"

provides="glfw=$pkgver-r$pkgrel"
replaces="glfw"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DGLFW_USE_WAYLAND=ON
	make -C build
}

package() {
	make -C build DESTDIR="$pkgdir" install
}

dev() {
	provides="glfw-dev=$pkgver-r$pkgrel"
	replaces="glfw-dev"

	default_dev
}

sha512sums="f5af749d33b5b900ccf07988ad0bf51bd766a18e4cf2bc2a76020c88e98a2528ff1b965224184fe0d290cfe34b1af1e6f633600660d81194fe354078e2f35c56  glfw-3.3.2.tar.gz"
